package com.tpp.comm.vo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Result {

    private boolean success;
    private String errorCode;
    private String msg;
    private Object data;

    public static Result success(Object data){
        Result r = new Result();
        r.setData(data);
        r.setErrorCode("0000");
        return r;
    }

    public static Result fail(String msg){
        Result r = new Result();
        r.setMsg(msg);
        r.setErrorCode("0002");
        r.setSuccess(false);
        return r;
    }

    public static Result noLogin(String msg){
        Result r = new Result();
        r.setMsg(msg);
        r.setErrorCode("0001");
        r.setSuccess(false);
        return r;
    }

}
